<script setup>
//
import { ref } from "vue";
import { regisAPI } from "@/apis/form";
const form = ref();
const formData = ref({
  name: "",
  password: "",
});

const regis = async () => {
  const formDataByForm = new FormData();
  Object.keys(formData.value).forEach((key) => {
    formDataByForm.append(key, formData.value[key]);
  });
  const res = await regisAPI(formDataByForm);
};
</script>

<template>
  <div class="index"></div>
  <form ref="form">
    <div>
      <label for="name">用户名</label>
      <input type="text" id="name" v-model="formData.name" />
    </div>

    <div>
      <label for="password">密码</label>
      <input type="text" id="password" v-model="formData.password" />
    </div>
    <button @click="regis">注册</button>
  </form>
</template>

<style lang="scss">
//
</style>
